#include <iostream>
#include <memory>
using namespace std;
enum ProductType:int
{
    PRODUCTA,
    PRODUCTB,
    PRODUCTC
};
class Product
{
public:
    explicit Product(){};
    virtual ~Product(){};
    virtual void Run() = 0;

};
class ProductA :public Product
{
    void Run() override{
           cout<<"run A..."<<endl;
    }
};
class ProductB :public Product
{
    void Run() override{
           cout<<"run B..."<<endl;
    }
};
class ProductC :public Product
{
    void Run() override{
           cout<<"run C..."<<endl;
    }
};


class Factory
{
public:
    explicit Factory(){}
    unique_ptr<Product>CreatProduct(ProductType Type){

        if(Type == ProductType::PRODUCTA)
        {
            return std::make_unique<ProductA>();
        }
        else if(Type == ProductType::PRODUCTB)
        {
            return make_unique<ProductB>();
        }
        else if(Type == ProductType::PRODUCTC)
        {
            return make_unique<ProductC>();
        }
        else
        {
            cout<<"return nullptr..."<<endl;
            return nullptr;
        }
    }
};
int main()
{
    cout << "Hello World!" << endl;
     Factory fac;
    {

        unique_ptr ProDuct = fac.CreatProduct(ProductType::PRODUCTA);
        ProDuct->Run();
    }


    {
        unique_ptr ProDuct = fac.CreatProduct(PRODUCTB);
        ProDuct->Run();
    }

    {
        unique_ptr ProDuct = fac.CreatProduct(PRODUCTC);
        ProDuct->Run();
    }

    return 0;
}
